<script language="JavaScript">

var state = 0;

function selectAll(formName){

	var cbTotal = document[formName].elements.length;
	
	for (var i=0;i<cbTotal;i++) {
		if (state == 0){
			document[formName].elements[i].checked = true;
		}
		else{
			document[formName].elements[i].checked = false;
		}
	}

	if (state == 0){
		state = 1;
		document.getElementById('A').style.display="none";
		document.getElementById('B').style.display="block";
	}
	else{
		state = 0;
		document.getElementById('A').style.display="block";
		document.getElementById('B').style.display="none";
	}
}

var state = 0;

function formsubmit(formName, actionaddress)
{
	document[formName].action=actionaddress;
	event.srcElement.style.display="none";
	document[formName].submit();
	return true;
}

function singleSubmit() {
	submitCount = submitCount + 1;
	if (submitCount == 1)
		return true;
    else
		return false;
}

function onKeyPress(formName,FocusElementName)
{
	if (event.keyCode == 13)
	{
		document[formName].elements(FocusElementName).focus();
		return false;
	}
	return true;
}

function frmSubmitEx(operationtype,formname,checkbox,Message,actionaddress) 
{
	if (operationtype == "Other") 
	{
		document[formName].action = actionaddress;
		event.srcElement.style.display="none";
		document[formName].submit();
		return true;
	}
	if (operationtype == "Del") 
	{
		j=0;
	    for (i=0;i<document.all.length;i++)
		{
		    if (document.all(i).name == 'checkbox' && document.all(i).checked)
			{
			    j++;
			}
		}
		if (j == 0)
        {
            alert("请至少选择一条"+Message+"进行删除!");
            return false;
        }
		if (!confirm("您确定要删除选中的这"+j+"条"+Message+"吗？\n删除动作是不可逆的！")) return false;
		document[formName].action = actionaddress;
		event.srcElement.style.display="none";
		document[formName].submit();
		return true;
	}
}
</script>